<template>
    <div class="header">
        <div class="header-box">
            <div class="logo">
            </div>
            <div class="nav">
                <ul>
                    <li>没用的按钮</li>
                    <li>没用的按钮</li>
                    <li>关于我们</li>
                    <li @click="goOut">退出登录</li>
                    <li>黑夜模式</li>
                </ul>
            </div>
        </div>
    </div>
</template>

<script lang="ts" setup>
import router from '@/router';
import { logout } from '@/utils/api';
import { ElMessage } from 'element-plus'

const goOut = async () => {
    const code = await logout()
    if (code == 200) {
        localStorage.clear()
        sessionStorage.clear()
        router.push({ name: 'login' })
        return ElMessage({
            message: '退出成功',
            type: 'success',
        })
    }
}
</script>

<style lang="scss" scoped>
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 1200px;
    width: 100%;
    overflow: hidden;
    min-height: 70px;
    // background-color: antiquewhite;
    border-bottom: 1px solid var(--brColor);
    box-shadow: 1px 1px 5px 3px var(--brShadow);
    margin-bottom: auto;

    .header-box {
        min-width: 80%;
        // background-color: aqua;
        // line-height: 80px;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .logo {
            width: 50px;
            height: 50px;
            background-image: url('../../assets/logo.png');
            background-repeat: no-repeat;
            background-size: cover;
        }

        .nav {
            ul {
                display: flex;

                li {
                    margin-right: 10px;
                    cursor: pointer;
                    transition: all 0.3s;

                    &:hover {
                        color: var(--bottenHover);
                    }
                }
            }
        }
    }

}
</style>